﻿package com.zit.service;

import java.util.ArrayList;
import java.util.List;

import org.hibernate.Session;
import org.hibernate.Transaction;

import com.zit.dao.BedroomDAO;
import com.zit.entity.Bedroom;

public class BedroomService extends BaseService {
	
	private BedroomDAO bedroomDAO=new BedroomDAO();
	
	/**
	 * 作者:唐美兰
	 * 功能:根据公寓Id查询公寓下面的所有寝室
	 * @return
	 */
	public List<Bedroom> select(int did){
		Session s = null;
		Transaction tx = null ;
		List<Bedroom> bedrooms=new ArrayList<Bedroom>();;
		try {
			s = getSession();
			tx = s.beginTransaction();
			bedrooms=bedroomDAO.select(did, s);
			tx.commit();
		} catch (Exception e) {
			e.printStackTrace();
		}finally{
			s.close();
		}
		return bedrooms;
	}
}
